package zsj.androidknife.utilsImpl;

import android.content.Context;
import android.graphics.Bitmap;
import android.widget.ImageView;

import zsj.androidknife.AndroidKnife;
import zsj.androidknife.Constants;
import zsj.androidknife.utils.IImageUtils;
import zsj.androidknife.utils.UiAction;

/**
 * Created by Administrator on 2016/4/19 0019.
 */
public class ImageUtils implements IImageUtils{
    @Override
    public void setImageView(final ImageView imageView, String url)
    {
        AndroidKnife.getHttpUtils(Constants.getContext()).sendBitmapRequest(url, new UiAction<Bitmap>() {
            @Override
            public void doInUI(Bitmap param) {
                imageView.setImageBitmap(param);
            }
        });
    }

    private static class InstanceHolder
    {
        public static ImageUtils INSTANCE = new ImageUtils();
    }
    public static ImageUtils getInstance()
    {
        return InstanceHolder.INSTANCE;
    }
    private ImageUtils(){}
}
